<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>splice</title>
	</head>
	<body>
		<p id="old">原始数组</p>
		<p id="mynew">修改后的数组</p>
		<button onclick="my()">点击</button>
		
		<script>
			function my(){
				var old=document.getElementById("old");
				var mynew=document.getElementById("mynew");
				
				var fruits=["Banana","Orange","Apple","Mango"];
				old.innerHTML=fruits;
				
				/*fruits.splice(2,0,"pear","peach");
				mynew.innerHTML=fruits;*/
				fruits.splice(2,2);
				mynew.innerHTML=fruits;
			}
		</script>
	</body>
</html>